package com.zzyl.controller.security;

import com.zzyl.base.ResponseResult;
import com.zzyl.dto.LoginDto;
import com.zzyl.service.LoginService;
import com.zzyl.vo.LoginVo;
import com.zzyl.vo.UserVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/security")
@Api(tags = "后台登录")

public class LoginController {

    private static final Logger log = LoggerFactory.getLogger(LoginController.class);
    @Autowired
    private LoginService loginService;

    @ApiOperation("后台用户登录")
    @PostMapping("/login")
    public ResponseResult<LoginVo> login(@RequestBody LoginDto dto) {
        log.info("后台用户登录:{}", dto);
        /*log.info("后台用户登录:{}", dto);
        LoginVo loginVo = new LoginVo();
        loginVo.setUserToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxx");
        loginVo.setNickName("admin");
        loginVo.setRealName("管理员");
        loginVo.setRealName("管理员");*/

        LoginVo loginVo = loginService.login(dto);
        return ResponseResult.success(loginVo);
    }
}